Completed
Push — master ( e3ee1d...5cbb1b )
by Justin
01:36
created

TextValue.js ➔ describe(ꞌTextValueꞌ)   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 41
rs 8.8571

5 Functions

Rating   Name   Duplication   Size   Complexity  
A TextValue.js ➔ ... ➔ it(ꞌCreate plainꞌ) 0 6 1
A TextValue.js ➔ ... ➔ it(ꞌBuildꞌ) 0 7 1
A TextValue.js ➔ ... ➔ it(ꞌtoJSONꞌ) 0 7 1
A TextValue.js ➔ ... ➔ it(ꞌCreate with JSONꞌ) 0 8 1
A TextValue.js ➔ ... ➔ it(ꞌconstructor does not copy instancesꞌ) 0 5 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('TextValue', function(){
5
  
6
  it('Create plain', function(){
7
    var newValue = new GedcomX.TextValue(),
8
        value = GedcomX.TextValue();
9
    assert.instanceOf(newValue, GedcomX.TextValue, 'An instance of TextValue is not returned when calling the constructor with new.');
10
    assert.instanceOf(value, GedcomX.TextValue, 'An instance of TextValue is not returned when calling the constructor without new.');
11
  });
12
  
13
  it('Create with JSON', function(){
14
    var value = GedcomX.TextValue({
15
      lang: 'en',
16
      value: 'a full text value'
17
    });
18
    assert.equal(value.getLang(), 'en');
19
    assert.equal(value.getValue(), 'a full text value');
20
  });
21
  
22
  it('Build', function(){
23
    var value = GedcomX.TextValue()
24
      .setLang('en')
25
      .setValue('a full text value');
26
    assert.equal(value.getLang(), 'en');
27
    assert.equal(value.getValue(), 'a full text value');
28
  });
29
  
30
  it('toJSON', function(){
31
    var data = {
32
      lang: 'en',
33
      value: 'a full text value'
34
    }, value = GedcomX.TextValue(data);
35
    assert.deepEqual(value.toJSON(), data);
36
  });
37
  
38
  it('constructor does not copy instances', function(){
39
    var obj1 = GedcomX.TextValue();
40
    var obj2 = GedcomX.TextValue(obj1);
41
    assert.strictEqual(obj1, obj2);
42
  });
43
  
44
});